# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com>
# Contributor: Mantas <grawity at gmail dot com>

pkgname=switcheroo-control
pkgver=2.6
pkgrel=4
pkgdesc="D-Bus service to check the availability of dual-GPU"
url="https://gitlab.freedesktop.org/hadess/switcheroo-control"
arch=(loong64 x86_64)
license=(GPL3)
depends=(
  glib2
  libgudev
  python-gobject
)
makedepends=(
  git
  gtk-doc
  meson
  python-dbus
  python-dbusmock
  systemd
)
checkdepends=(umockdev)
_commit=0dd257edd6b27589d2a1013cda1d2d5f325eee8b  # tags/2.6^0
source=("git+$url.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

build() {
  local meson_options=(
    -D gtk_doc=true
    -D tests=true
  )

  arch-meson $pkgname build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
